package com.example.demo.web;

import com.example.demo.pojo.Supervisor;
import com.example.demo.service.ISupervisorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/supervisor")
@CrossOrigin( "*")
public class SupervisorWeb {
    @Autowired
    private ISupervisorService supervisorService;

    // 公众监督员登录接口
    @RequestMapping("/getSupervisorByIdByPass")
    public Supervisor getSupervisorByIdByPass(@RequestBody Supervisor supervisor) {
        return supervisorService.getSupervisorByIdByPass(supervisor);
    }

    // 公众监督员注册接口
    @RequestMapping("/saveSupervisor")
    public int saveSupervisor(@RequestBody Supervisor supervisor) {
        return supervisorService.saveSupervisor(supervisor);
    }

    // 验证手机号码是否被注册
    @RequestMapping("/getSupervisorById")
    public Supervisor getSupervisorById(@RequestBody Supervisor supervisor) {
        return supervisorService.getSupervisorById(supervisor.getTelId());
    }
}